package com.csthink.web.interfaces;

import com.csthink.web.application.dto.test.TestDTO;
import com.csthink.web.domain.Test;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author <a href="mailto:security.2009@live.cn">Mars</a>
 * @since 2023-09-09
 */
@Api(tags = "Test 模块")
@Slf4j
@RestController
@RequestMapping("api/v1/test")
public class TestController {

    @ApiOperation(value = "test val", notes = "test notes")
    @GetMapping("/t1")
    public String test() {
        return "Hello,World";
    }

    @ApiOperation("test2 方法")
    @GetMapping("/t2")
    public Test test2() {
        return Test.builder()
                .name("jack")
                .age(null)
                .build();
    }

    @ApiOperation("test3 方法")
    @PostMapping("/t3")
    public TestDTO test3(@Validated @RequestBody TestDTO dto) {
        return dto;
    }
}
